package cn.six1943.deepchat.module.ai.dal.mysql.provider;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.six1943.deepchat.module.ai.dal.dataobject.provider.ProviderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.six1943.deepchat.module.ai.controller.admin.provider.vo.*;

/**
 * AI提供商 Mapper
 *
 * @author at1943
 */
@Mapper
public interface ProviderMapper extends BaseMapperX<ProviderDO> {

    default PageResult<ProviderDO> selectPage(ProviderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProviderDO>()
                // .eqIfPresent(ProviderDO::getDataType, reqVO.getDataType())
                .likeIfPresent(ProviderDO::getName, reqVO.getName())
                .likeIfPresent(ProviderDO::getCode, reqVO.getCode())
                .eqIfPresent(ProviderDO::getModel, reqVO.getModel())
                .eqIfPresent(ProviderDO::getAgent, reqVO.getAgent())
                .betweenIfPresent(ProviderDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProviderDO::getStatus, reqVO.getStatus())
                .orderByAsc(ProviderDO::getStatus, ProviderDO::getSort));
    }

    List<ProviderRespVO> selectAppProvider(Long userTenantId);
}